package com.heima.admin.controller.v1;

import com.heima.admin.service.AdLogService;
import com.heima.model.admin.dtos.AdUserLogDTO;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/userlog")
@Api(value = "日志管理controller",tags = "日志管理controller")
public class AdLogController {

    @Autowired
    AdLogService adLogService;

    /**
     *
     * Ro  requestOperation  操作名称
     * Rm  requestMethod     请示方式
     */
    @ApiOperation(value = "根据条件分页查询日志信息",notes = "按照Ro和Rm模糊分页查询，结果按照时间降序排序")
    @PostMapping("list")
    public ResponseResult findAll(@RequestBody AdUserLogDTO dto){
        return adLogService.findByRoAndRm(dto);
    }

    @ApiOperation(value = "删除日志信息",notes = "删除日志信息")
    @GetMapping("del/{id}")
    public ResponseResult deleteById(@PathVariable("id") Integer id){
        return adLogService.deleteById(id);
    }
}
